Linear Search



Linear search is a simple searching algorithm used to find a particular element in a list or array. It works by sequentially checking each element of the list from the beginning until the desired element is found or the entire list has been searched.

How Binary Search Works:

Initial Setup:
          1) Start at the beginning of the list.
          2) Compare the current element with the target element.
          3) If the current element matches the target, return the index of the current element.
          4) If the current element does not match the target, move to the next element in the list.
          5) Repeat steps 2–4 until either the target is found or the end of the list is reached.
          6) If the target is not found by the time you reach the end of the list, return an indication (e.g., -1 or None) that the element is not in the list.